package com.wlstock.funi.ui;

import android.graphics.Color;
import android.os.Bundle;

import com.wlstock.funi.R;

import org.apache.cordova.CordovaActivity;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CordovaWebViewImpl;
import org.apache.cordova.engine.SystemWebView;
import org.apache.cordova.engine.SystemWebViewEngine;

public class TestWebView extends CordovaActivity {

	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test_web_view);
		super.init();
//         launchUrl = "file:///android_asset/www/index.html";
		loadUrl("http://stocks.sina.cn/sh/?code=sz002716&vt=4#H5Picture");
//        loadUrl(launchUrl);
	}

	@Override
	protected CordovaWebView makeWebView() {
		SystemWebView webView = (SystemWebView)findViewById(R.id.cordovaWebView);
		return new CordovaWebViewImpl(new SystemWebViewEngine(webView));
	}

	@Override
	protected void createViews() {
		//Why are we setting a constant as the ID? This should be investigated

		if (preferences.contains("BackgroundColor")) {
			int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
			// Background of activity:
			appView.getView().setBackgroundColor(backgroundColor);
		}
		appView.getView().requestFocusFromTouch();
	}
}
